/**
 * @summary 频道模块
 * @author 陈俊可
 * @description
 *     这是个菜鸡
 */

import * as channelApi from '@/api/channel';
export default {
  namespaced: true,
  state: {
    // 频道列表
    channelList: [],
  },
  mutations: {
    SET_CHANNEL_LIST(state, newValue) {
      state.channelList = newValue;
    },
  },
  actions: {
    async updateChannelList({ commit }) {
      // 发请求
      const res = await channelApi.getChannelList();
      // 拿到数据
      // 把数据传给mutation
      // 把mutation改数据
      commit('SET_CHANNEL_LIST', res);
    },
  },
}
